/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ShahanThai
 */
@Entity
@Table(name = "Upload", catalog = "SharingMusic", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Upload.findAll", query = "SELECT u FROM Upload u"),
    @NamedQuery(name = "Upload.findByUploadID", query = "SELECT u FROM Upload u WHERE u.uploadID = :uploadID"),
    @NamedQuery(name = "Upload.findByUploadDate", query = "SELECT u FROM Upload u WHERE u.uploadDate = :uploadDate")})
public class Upload implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "UploadID", nullable = false)
    private int uploadID;
    @Basic(optional = false)
    @Column(name = "UploadDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date uploadDate;
    @JoinColumn(name = "Username", referencedColumnName = "Username", nullable = false)
    @ManyToOne(optional = false)
    private Users users;
    @JoinColumn(name = "SongID", referencedColumnName = "SongID", nullable = false)
    @ManyToOne(optional = false)
    private Songs songs;

    public Upload() {
    }

    public Upload(int uploadID) {
        this.uploadID = uploadID;
    }

    public Upload(int uploadID, Date uploadDate) {
        this.uploadID = uploadID;
        this.uploadDate = uploadDate;
    }

    public int getUploadID() {
        return uploadID;
    }

    public void setUploadID(int uploadID) {
        this.uploadID = uploadID;
    }

    public Date getUploadDate() {
        return uploadDate;
    }

    public void setUploadDate(Date uploadDate) {
        this.uploadDate = uploadDate;
    }

    public Users getUsers() {
        return users;
    }

    public void setUsers(Users users) {
        this.users = users;
    }

    public Songs getSongs() {
        return songs;
    }

    public void setSongs(Songs songs) {
        this.songs = songs;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash = this.uploadID;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Upload)) {
            return false;
        }
        Upload other = (Upload) object;
        if (this.uploadID != other.uploadID) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.Upload[uploadID=" + uploadID + "]";
    }

}
